﻿using Prism.Commands;
using Prism.Events;
using System;

namespace LpbPrj.Client.ViewModels
{
    public class ConfirmViewModel : DialogBaseViewModel
    {
        public DelegateCommand<System.Windows.RoutedEventArgs> ConfirmPasswordCommand =>
            new Lazy<DelegateCommand<System.Windows.RoutedEventArgs>>(() => new DelegateCommand<System.Windows.RoutedEventArgs>(p =>
            {
                if (p.Source is System.Windows.Controls.PasswordBox)
                {
                    confirmPassword = ((System.Windows.Controls.PasswordBox)p.Source).Password;
                }
            })).Value;

        public override bool CanCloseDialog()
        {
            return !string.IsNullOrEmpty(confirmPassword) && confirmPassword.Equals("Suoer");
        }

        public ConfirmViewModel(IEventAggregator eventAggregator, Prism.Regions.IRegionManager regionManager, Prism.Services.Dialogs.IDialogService dialogService)
            : base(eventAggregator, regionManager, dialogService)
        {
            Title = "ConfirmPassword";
        }

        private string confirmPassword = string.Empty;


    }
}
